using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Export.Xls;
using SS;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
using TVSBH.func;
namespace TVSGPP.func
{
	public class frmBookSaleByBill : Form
	{
		private IContainer components = null;
		private DataGridView dgvProduct;
		private Button btnExportToExcel;
		private Button btnPrint;
		private Button btnClose;
		private GroupBox groupBox1;
		private Button btnSearch;
		private System.Windows.Forms.Label label25;
		private System.Windows.Forms.Label label17;
		private DateTimePicker dtpTo;
		private DateTimePicker dtpFrom;
		private DataGridViewTextBoxColumn CreateDate;
		private DataGridViewTextBoxColumn _Name;
		private DataGridViewTextBoxColumn _Address;
		private DataGridViewTextBoxColumn _Age;
		private DataGridViewTextBoxColumn _Sex;
		private DataGridViewTextBoxColumn _DoctorName;
		private DataGridViewTextBoxColumn _DoctorDesease;
		private DataGridViewTextBoxColumn productName;
		private DataGridViewTextBoxColumn productUnit;
		private DataGridViewTextBoxColumn packet;
		private DataGridViewTextBoxColumn ProductExpiryDate;
		private DataGridViewTextBoxColumn IdBisMake;
		private DataGridViewTextBoxColumn productNumber;
		private DataTable objTable = new DataTable();
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmBookSaleByBill));
			this.dgvProduct = new DataGridView();
			this.CreateDate = new DataGridViewTextBoxColumn();
			this._Name = new DataGridViewTextBoxColumn();
			this._Address = new DataGridViewTextBoxColumn();
			this._Age = new DataGridViewTextBoxColumn();
			this._Sex = new DataGridViewTextBoxColumn();
			this._DoctorName = new DataGridViewTextBoxColumn();
			this._DoctorDesease = new DataGridViewTextBoxColumn();
			this.productName = new DataGridViewTextBoxColumn();
			this.productUnit = new DataGridViewTextBoxColumn();
			this.packet = new DataGridViewTextBoxColumn();
			this.ProductExpiryDate = new DataGridViewTextBoxColumn();
			this.IdBisMake = new DataGridViewTextBoxColumn();
			this.productNumber = new DataGridViewTextBoxColumn();
			this.btnExportToExcel = new Button();
			this.btnPrint = new Button();
			this.btnClose = new Button();
			this.groupBox1 = new GroupBox();
			this.btnSearch = new Button();
			this.label25 = new System.Windows.Forms.Label();
			this.label17 = new System.Windows.Forms.Label();
			this.dtpTo = new DateTimePicker();
			this.dtpFrom = new DateTimePicker();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			this.groupBox1.SuspendLayout();
			base.SuspendLayout();
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeight = 26;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.CreateDate,
				this._Name,
				this._Address,
				this._Age,
				this._Sex,
				this._DoctorName,
				this._DoctorDesease,
				this.productName,
				this.productUnit,
				this.packet,
				this.ProductExpiryDate,
				this.IdBisMake,
				this.productNumber
			});
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new Point(7, 66);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(886, 493);
			this.dgvProduct.TabIndex = 1;
			this.CreateDate.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.CreateDate.DataPropertyName = "CreateDate";
			dataGridViewCellStyle2.Format = "D";
			dataGridViewCellStyle2.NullValue = null;
			this.CreateDate.DefaultCellStyle = dataGridViewCellStyle2;
			this.CreateDate.HeaderText = "Ngày tháng";
			this.CreateDate.MinimumWidth = 76;
			this.CreateDate.Name = "CreateDate";
			this.CreateDate.ReadOnly = true;
			this.CreateDate.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.CreateDate.Width = 76;
			this._Name.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this._Name.DataPropertyName = "_Name";
			this._Name.HeaderText = "Tên người bệnh";
			this._Name.MinimumWidth = 170;
			this._Name.Name = "_Name";
			this._Name.ReadOnly = true;
			this._Name.SortMode = DataGridViewColumnSortMode.NotSortable;
			this._Name.Width = 170;
			this._Address.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this._Address.DataPropertyName = "_Address";
			this._Address.HeaderText = "Địa chỉ";
			this._Address.MinimumWidth = 200;
			this._Address.Name = "_Address";
			this._Address.ReadOnly = true;
			this._Address.SortMode = DataGridViewColumnSortMode.NotSortable;
			this._Address.Width = 200;
			this._Age.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this._Age.DataPropertyName = "_Age";
			dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleRight;
			this._Age.DefaultCellStyle = dataGridViewCellStyle3;
			this._Age.HeaderText = "Tuổi";
			this._Age.MinimumWidth = 40;
			this._Age.Name = "_Age";
			this._Age.ReadOnly = true;
			this._Age.SortMode = DataGridViewColumnSortMode.NotSortable;
			this._Age.Width = 40;
			this._Sex.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this._Sex.DataPropertyName = "_Sex";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleCenter;
			this._Sex.DefaultCellStyle = dataGridViewCellStyle4;
			this._Sex.HeaderText = "Giới tính";
			this._Sex.MinimumWidth = 60;
			this._Sex.Name = "_Sex";
			this._Sex.ReadOnly = true;
			this._Sex.Resizable = DataGridViewTriState.True;
			this._Sex.SortMode = DataGridViewColumnSortMode.NotSortable;
			this._Sex.Width = 60;
			this._DoctorName.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this._DoctorName.DataPropertyName = "_DoctorName";
			this._DoctorName.HeaderText = "Bác sĩ kê đơn";
			this._DoctorName.MinimumWidth = 170;
			this._DoctorName.Name = "_DoctorName";
			this._DoctorName.ReadOnly = true;
			this._DoctorName.SortMode = DataGridViewColumnSortMode.NotSortable;
			this._DoctorName.Width = 170;
			this._DoctorDesease.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this._DoctorDesease.DataPropertyName = "_DoctorDesease";
			this._DoctorDesease.HeaderText = "Chuẩn đoán của Bác sĩ";
			this._DoctorDesease.Name = "_DoctorDesease";
			this._DoctorDesease.ReadOnly = true;
			this._DoctorDesease.SortMode = DataGridViewColumnSortMode.NotSortable;
			this._DoctorDesease.Visible = false;
			this.productName.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.productName.DataPropertyName = "productName";
			this.productName.HeaderText = "Tên thuốc";
			this.productName.MinimumWidth = 180;
			this.productName.Name = "productName";
			this.productName.ReadOnly = true;
			this.productName.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.productName.Width = 180;
			this.productUnit.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.productUnit.DataPropertyName = "productUnit";
			this.productUnit.HeaderText = "Đơn vị tính";
			this.productUnit.MinimumWidth = 75;
			this.productUnit.Name = "productUnit";
			this.productUnit.ReadOnly = true;
			this.productUnit.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.productUnit.Width = 75;
			this.packet.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.packet.DataPropertyName = "packet";
			this.packet.HeaderText = "Số lô";
			this.packet.MinimumWidth = 80;
			this.packet.Name = "packet";
			this.packet.ReadOnly = true;
			this.packet.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.packet.Width = 80;
			this.ProductExpiryDate.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductExpiryDate.DataPropertyName = "ProductExpiryDate";
			dataGridViewCellStyle5.Format = "D";
			dataGridViewCellStyle5.NullValue = null;
			this.ProductExpiryDate.DefaultCellStyle = dataGridViewCellStyle5;
			this.ProductExpiryDate.HeaderText = "Hạn sử dụng";
			this.ProductExpiryDate.MinimumWidth = 85;
			this.ProductExpiryDate.Name = "ProductExpiryDate";
			this.ProductExpiryDate.ReadOnly = true;
			this.ProductExpiryDate.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.ProductExpiryDate.Width = 85;
			this.IdBisMake.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.IdBisMake.DataPropertyName = "ProviderName";
			this.IdBisMake.HeaderText = "Nhà cung cấp";
			this.IdBisMake.MinimumWidth = 200;
			this.IdBisMake.Name = "IdBisMake";
			this.IdBisMake.ReadOnly = true;
			this.IdBisMake.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.IdBisMake.Width = 200;
			this.productNumber.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.productNumber.DataPropertyName = "productNumber";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
			this.productNumber.DefaultCellStyle = dataGridViewCellStyle6;
			this.productNumber.HeaderText = "SL Mua";
			this.productNumber.MinimumWidth = 55;
			this.productNumber.Name = "productNumber";
			this.productNumber.ReadOnly = true;
			this.productNumber.Width = 55;
			this.btnExportToExcel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnExportToExcel.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnExportToExcel.FlatStyle = FlatStyle.Flat;
			this.btnExportToExcel.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnExportToExcel.Location = new Point(119, 566);
			this.btnExportToExcel.Name = "btnExportToExcel";
			this.btnExportToExcel.Size = new Size(102, 26);
			this.btnExportToExcel.TabIndex = 8;
			this.btnExportToExcel.Text = "Xuất file Excel";
			this.btnExportToExcel.UseVisualStyleBackColor = true;
			this.btnExportToExcel.Click += new EventHandler(this.btnExportToExcel_Click);
			this.btnPrint.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new Point(7, 566);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(109, 26);
			this.btnPrint.TabIndex = 7;
			this.btnPrint.Text = "In báo cáo [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = true;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click);
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new Point(793, 566);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(100, 26);
			this.btnClose.TabIndex = 10;
			this.btnClose.Text = "Thoát [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = true;
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox1.Controls.Add(this.btnSearch);
			this.groupBox1.Controls.Add(this.label25);
			this.groupBox1.Controls.Add(this.label17);
			this.groupBox1.Controls.Add(this.dtpTo);
			this.groupBox1.Controls.Add(this.dtpFrom);
			this.groupBox1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox1.Location = new Point(7, 6);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(886, 54);
			this.groupBox1.TabIndex = 69;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Thời gian xem sổ";
			this.btnSearch.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnSearch.FlatStyle = FlatStyle.Flat;
			this.btnSearch.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
//			this.btnSearch.Image = (Image)componentResourceManager.GetObject("btnSearch.Image");
			this.btnSearch.Location = new Point(366, 21);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new Size(21, 21);
			this.btnSearch.TabIndex = 152;
			this.btnSearch.UseVisualStyleBackColor = true;
			this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
			this.label25.AutoSize = true;
			this.label25.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.label25.Location = new Point(113, 24);
			this.label25.Name = "label25";
			this.label25.Size = new Size(57, 15);
			this.label25.TabIndex = 151;
			this.label25.Text = "Từ ngày :";
			this.label17.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
//			this.label17.Image = (Image)componentResourceManager.GetObject("label17.Image");
			this.label17.Location = new Point(258, 20);
			this.label17.Name = "label17";
			this.label17.Size = new Size(20, 25);
			this.label17.TabIndex = 150;
			this.dtpTo.CustomFormat = "dd/MM/yyyy";
			this.dtpTo.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpTo.Format = DateTimePickerFormat.Custom;
			this.dtpTo.Location = new Point(280, 21);
			this.dtpTo.Name = "dtpTo";
			this.dtpTo.Size = new Size(81, 21);
			this.dtpTo.TabIndex = 149;
			this.dtpFrom.CustomFormat = "dd/MM/yyyy";
			this.dtpFrom.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpFrom.Format = DateTimePickerFormat.Custom;
			this.dtpFrom.Location = new Point(174, 21);
			this.dtpFrom.Name = "dtpFrom";
			this.dtpFrom.Size = new Size(81, 21);
			this.dtpFrom.TabIndex = 148;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(900, 600);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.btnExportToExcel);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.dgvProduct);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			base.Name = "frmBookSaleByBill";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "SỔ BÁN THUỐC THEO ĐƠN";
			base.Load += new EventHandler(this.frmBookSaleByBill_Load);
			((ISupportInitialize)this.dgvProduct).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			base.ResumeLayout(false);
		}
		public frmBookSaleByBill()
		{
			this.InitializeComponent();
		}
		private void frmBookSaleByBill_Load(object sender, EventArgs e)
		{
			this.getData();
		}
		private void getData()
		{
			this.objTable = new DataTable();
			this.dgvProduct.AutoGenerateColumns = false;
			DataColumn column = new DataColumn("billID", typeof(string));
			DataColumn column2 = new DataColumn("CreateDate", typeof(DateTime));
			DataColumn column3 = new DataColumn("_Name", typeof(string));
			DataColumn column4 = new DataColumn("_Address", typeof(string));
			DataColumn column5 = new DataColumn("_Age", typeof(string));
			DataColumn column6 = new DataColumn("_Sex", typeof(string));
			DataColumn column7 = new DataColumn("_DoctorName", typeof(string));
			DataColumn column8 = new DataColumn("_DoctorDesease", typeof(string));
			DataColumn column9 = new DataColumn("productName", typeof(string));
			DataColumn column10 = new DataColumn("productUnit", typeof(string));
			DataColumn column11 = new DataColumn("Packet", typeof(string));
			DataColumn column12 = new DataColumn("ProductExpiryDate", typeof(DateTime));
			DataColumn column13 = new DataColumn("ProviderName", typeof(string));
			DataColumn column14 = new DataColumn("productNumber", typeof(float));
			this.objTable.Columns.Add(column);
			this.objTable.Columns.Add(column2);
			this.objTable.Columns.Add(column3);
			this.objTable.Columns.Add(column4);
			this.objTable.Columns.Add(column5);
			this.objTable.Columns.Add(column6);
			this.objTable.Columns.Add(column7);
			this.objTable.Columns.Add(column8);
			this.objTable.Columns.Add(column9);
			this.objTable.Columns.Add(column10);
			this.objTable.Columns.Add(column11);
			this.objTable.Columns.Add(column12);
			this.objTable.Columns.Add(column13);
			this.objTable.Columns.Add(column14);
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			sqlConnection.Open();
			SqlCommand sqlCommand = new SqlCommand("SELECT *, dbo.uf_getProviderName(TabBill.PID) AS ProviderName FROM TabBill,TabDetailBill WHERE [TabBill].[CreateDate] BETWEEN @ObjDate1 AND @objDate2 AND [TabBill].[ID] = [TabDetailBill].[billID] AND [_DoctorName] <> 'NONE' AND TypeInput = 'OUT4' ORDER BY [TabBill].[CreateDate] ASC", sqlConnection);
			SqlParameter sqlParameter = new SqlParameter("ObjDate1", SqlDbType.DateTime);
			SqlParameter sqlParameter2 = new SqlParameter("ObjDate2", SqlDbType.DateTime);
			sqlParameter.Value = DateTime.Parse(this.dtpFrom.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
			sqlParameter2.Value = DateTime.Parse(this.dtpTo.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
			sqlCommand.Parameters.Add(sqlParameter);
			sqlCommand.Parameters.Add(sqlParameter2);
			SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
			while (sqlDataReader.Read())
			{
				if (!this.checkInDataGridView(sqlDataReader["ID"].ToString()))
				{
					this.objTable.Rows.Add(new object[]
					{
						sqlDataReader["ID"].ToString(),
						sqlDataReader["CreateDate"].ToString(),
						sqlDataReader["_Name"].ToString(),
						sqlDataReader["_Address"].ToString(),
						sqlDataReader["_Age"].ToString(),
						sqlDataReader["_Sex"].ToString().Replace("0", "Nam").Replace("1", "Nữ"),
						sqlDataReader["_DoctorName"].ToString(),
						sqlDataReader["_DoctorDesease"].ToString(),
						sqlDataReader["productName"].ToString(),
						sqlDataReader["productUnit"].ToString(),
						sqlDataReader["Packet"].ToString(),
						sqlDataReader["ProductExpiryDate"].ToString(),
						sqlDataReader["ProviderName"].ToString(),
						sqlDataReader["productNumber"].ToString()
					});
				}
				else
				{
					this.objTable.Rows.Add(new object[]
					{
						"",
						null,
						"",
						"",
						"",
						"",
						"",
						"",
						sqlDataReader["productName"].ToString(),
						sqlDataReader["productUnit"].ToString(),
						sqlDataReader["Packet"].ToString(),
						sqlDataReader["ProductExpiryDate"].ToString(),
						sqlDataReader["ProviderName"].ToString(),
						sqlDataReader["productNumber"].ToString()
					});
				}
			}
			sqlDataReader.Close();
			sqlConnection.Close();
			sqlConnection.Dispose();
			this.dgvProduct.DataSource = this.objTable;
		}
		private bool checkInDataGridView(string billID)
		{
			bool result = false;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				if (this.objTable.Rows[i]["billID"].ToString().ToUpper() == billID)
				{
					result = true;
				}
			}
			return result;
		}
		private void btnExportToExcel_Click(object sender, EventArgs e)
		{
			try
			{
				frmBookSaleByBillPrint.objTable = new DataTable();
				frmBookSaleByBillPrint.objTable = this.objTable;
				ActiveReport3 activeReport = new frmBookSaleByBillPrint();
				activeReport.Run();
				XlsExport xlsExport = new XlsExport();
				SaveFileDialog saveFileDialog = new SaveFileDialog();
				saveFileDialog.ShowDialog();
				string text = saveFileDialog.FileName;
				if (text != "")
				{
					if (!text.ToUpper().Contains(".XLS"))
					{
						text += ".xls";
					}
					xlsExport.MinRowHeight = 0f;
					xlsExport.UseCellMerging = true;
					xlsExport.Export(activeReport.Document, text);
					MessageBox.Show("Hệ thống đã hoàn thành việc xuất dữ liệu ra file Excel", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
				else
				{
					MessageBox.Show("Bạn chưa chọn đường dẫn và tên file cần xuất!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				}
			}
			catch
			{
			}
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
			frmBookSellNotBillView frmBookSellNotBillView = new frmBookSellNotBillView();
			frmBookSellNotBillView.objectName = "BookSaleByBill";
			frmBookSaleByBillPrint.objTable = this.objTable;
			frmBookSellNotBillView.ShowDialog();
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{
			this.getData();
		}
	}
}
